#include <stdio.h>
#include <stdlib.h>
#include <mysql/mysql.h>
int main(int argc,char *argv[]){
	//1. define a connection object
	MYSQL con;
	//2. Initialize the connection object
	if(mysql_init(&con)){//return object address 
		printf("Connection handle initialized\n");
	}
	else{
		printf("Connection handle initialization failed\n");
		exit (1);
	}
	//3. connect to MysQL server on localhost
	if(mysql_real_connect(&con,"localhost", "root","1q2w3e!Q@W#E","learn",3306,NULL,0)){
		printf("connection to remote MysQL server oK\n");
	}
	else{
		printf("connection to remote MysQL failed\n");
		exit(1);
	}
	//4. c1ose the connection when done
	mysql_close(&con);
}

